const Koa = require('koa');
const Router = require('koa-router')

const app = new Koa();
const router = new Router();

router.get('/', (ctx, next) => {
  ctx.redirect('/index');
})

router.get('/index', (ctx, next) => {
  ctx.body = '新闻页面';
})

router.get('/details', (ctx, next) => {
  ctx.body = '详细页面';
})

router.get('/test', (ctx, next) => {
  ctx.body = {
    name: '张三',
    age: 20
  };
})

app.use(router.routes());

app.listen(8888);